package easy;

public class Solution_1437 {

    public boolean kLengthApart(int[] nums, int k) {
        for (int i = 0, count = k; i < nums.length; i++) {
            if (nums[i] == 1) {
                if (count < k) {
                    return false;
                }
                count = 0;
            } else {
                count++;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        Solution_1437 model = new Solution_1437();
        System.out.println(model.kLengthApart(new int[]{1, 0, 0, 0, 1, 0, 0, 1}, 2));
        System.out.println(model.kLengthApart(new int[]{1, 0, 0, 1, 0, 1}, 2));
        System.out.println(model.kLengthApart(new int[]{1, 1, 1, 1, 1}, 0));
        System.out.println(model.kLengthApart(new int[]{0, 1, 0, 1}, 1));
    }
}
